#ifndef VECTORFONT_H
#define VECTORFONT_H

#include <QObject>
#include <QPoint>
#include "typedef.h"

class CChinese_char
{
public:
    WORD m_wCharCode;
    WORD m_wBytes;
    DWORD m_dwPosition;

    CChinese_char()
    {
        m_wCharCode=0;
        m_wBytes=0;
        m_dwPosition=0;
    }
    CChinese_char(const CChinese_char &a)
    {
        m_wCharCode=a.m_wCharCode;
        m_wBytes=a.m_wBytes;
        m_dwPosition=a.m_dwPosition;
    }
    CChinese_char(WORD wCharCode,WORD wBytes,DWORD dwPosition)
    {
        m_wCharCode=wCharCode;
        m_wBytes=wBytes;
        m_dwPosition=dwPosition;
    }
    ~CChinese_char() {}
    CChinese_char operator=(const CChinese_char &a)
    {
        m_wCharCode=a.m_wCharCode;
        m_wBytes=a.m_wBytes;
        m_dwPosition=a.m_dwPosition;
        return *this;
    }
};

class CEnglish_char
{
public:
        WORD m_wCharCode;
        WORD m_wBytes;
        WORD m_wWidth;
        DWORD m_dwPosition;

        CEnglish_char()
        {
            m_wCharCode=0;
            m_wBytes=0;
            m_wWidth=0;
            m_dwPosition=0;
        }
        CEnglish_char(const CEnglish_char &a)
        {
            m_wCharCode=a.m_wCharCode;
            m_wBytes=a.m_wBytes;
            m_wWidth=a.m_wWidth;
            m_dwPosition=a.m_dwPosition;
        }
        CEnglish_char(WORD wCharCode,WORD wBytes,WORD wWidth,DWORD dwPosition)
        {
            m_wCharCode=wCharCode;
            m_wBytes=wBytes;
            m_wWidth=wWidth;
            m_dwPosition=dwPosition;
        }
        ~CEnglish_char() {}
        CEnglish_char operator=(const CEnglish_char &a)
        {
            m_wCharCode=a.m_wCharCode;
            m_wBytes=a.m_wBytes;
            m_wWidth=a.m_wWidth;
            m_dwPosition=a.m_dwPosition;
            return *this;
        }
};
class VectorFont : public QObject
{
    Q_OBJECT
public:
    explicit VectorFont(QObject *parent = 0);
    ~VectorFont();
    void IniVectorFont();


signals:
    void siLineTo(bool bl,QPoint point);
    void siMoveTo(bool bl,QPoint point);

public slots:
protected:

    double m_iDPMM;  //长度数据单位:m_iDPMM(每毫米点)
    double m_dRake;   //倾斜角(第1个字符原点到最后1个字符原点的连线的角度),单位:弧度

    QString m_workPath;

    //QList <CChinese_char> m_aChinese_char;
    //QList <CEnglish_char> m_aEnglish_char;
    CChinese_char *m_pChinese_char;
    CEnglish_char *m_pEnglish_char;
    int m_nChinese_char_count;
    int m_nEnglish_char_count;
    int m_nInternalLeading_E,m_nHeight_E,m_nDescent_E; //m_nHeight_E是windows中字体的Ascent-InternalLeading
    int m_nHeight_C,m_nWidth_C;
public:

    void PlotChar(QPoint ptPointLU,BYTE*pbyData,WORD wBytes,int nLeft,int nDown,int nFontScale);
    QPoint CPToLP(QPoint ptCP,int nHeight,QPoint ptPointLU,double dSin,double dCos,double dScale);
    void TextOutString(int x, int y, const char* lpszString, int nCount);
    void Arc(int nLeftRect,int nTopRect,int nRightRect,int nBottomRect,int nXStartArc,int nYStartArc,int nXEndArc,int nYEndArc);
    QPoint GetNextCoodinate(WORD wDirection,WORD wLength,QPoint ptPoint);
    void MoveTo(QPoint ptPoint);
    void MoveTo(long x,long y);
    void LineTo(QPoint ptPoint);
    void LineTo(long x,long y);
    double angle_2(int startx,int starty,int endx,int endy);
    bool CircleCR(double x1,double y1,double x2,double y2,double x3,double y3,double& cx,double& cy,double& cr);

    double m_dFontHeight;      //字的高度
    double m_dFontAngle;//指定每行文本输出时相对于设备x轴的角度，其单位为1/10度



};

#endif // VECTORFONT_H
